package com.zr.sms.servlet;
/**
 * 根据购物清单编查询信息
 */
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONObject;

import com.zr.sms.model.Shoplist;
import com.zr.sms.service.SelectService;
import com.zr.sms.serviceimpl.SelectServiceImpl;

public class SerchshoplistServlet extends HttpServlet{
	SelectService select=new SelectServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
         doGet(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setCharacterEncoding("utf-8");
	    int sid=Integer.parseInt(req.getParameter("sid"));
	    Shoplist s=select.selectShopListBySid(sid);
	    HttpSession session =req.getSession();
	    session.setAttribute("shoplist", s);
	    String scontent=s.getScontent();
	  
	    JSONObject obj =JSONObject.fromObject(scontent);
	    double totalmoney=s.getStotalmoney();
	    obj.put("totalmoney", totalmoney);
	    PrintWriter out=resp.getWriter();
	    out.write(obj.toString());
	    
	   
	}

}
